package com.qr.controller;

import com.qr.service.AccountService;
import com.qr.service.AccountSetOtherService;
import com.qr.service.AccountSetService;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class AccountController {

    public static void main(String[] args) {
        //构造方法创建对象，读取值
       test1();
       test2();
       test3();
    }

    public static void test1(){
        //读取配置文件
        ClassPathXmlApplicationContext resource = new ClassPathXmlApplicationContext("bean.xml");
        AccountService accountService = (AccountService) resource.getBean("accountService");
        accountService.save();
    }
    public static void test2(){
        //读取配置文件
        ClassPathXmlApplicationContext resource = new ClassPathXmlApplicationContext("beanset.xml");
        //转成对应的类型
        AccountSetService accountService = (AccountSetService) resource.getBean("accountService");
        accountService.save();
    }
    public static void test3(){
        //读取配置文件
        ClassPathXmlApplicationContext resource = new ClassPathXmlApplicationContext("beansetother.xml");
        //转成对应的类型
        AccountSetOtherService accountService = (AccountSetOtherService) resource.getBean("accountService");
        accountService.save();
    }
}
